//
//  ZZLightViewCell.m
//  ZZBlue
//
//  Created by stonesMonkey on 2017/9/22.
//  Copyright © 2017年 stonesMonkey. All rights reserved.
//

#import "ZZLightViewCell.h"
#import "ZZLightViewCellModel.h"
#import "ZZLightViewGroupModel.h"
#import "ZZCircleTool.h"
#import "ZZLightViewSettingVC.h"
#import "ZZColorRGBA.h"
#import "ZZView.h"

#define kInColor [UIColor zColorWithRed:24 green:23 blue:23]
#define kLineWidth 12
#define klineColor [UIColor zColorWithRed:52 green:52 blue:52]
@interface ZZLightViewCell()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;


@property (weak, nonatomic) IBOutlet UIButton *addBtn;

@property (weak, nonatomic) IBOutlet UIView *lightViewContentView;

@property (weak, nonatomic) IBOutlet UIButton *setBtn;

@property (weak, nonatomic) IBOutlet UIView *bgView;

@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIImageView *directionImage;


@end

@implementation ZZLightViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.addBtn.layer.cornerRadius = 15 ;
    self.addBtn.layer.masksToBounds = YES;
    self.bgView.layer.cornerRadius = 5;
    self.bgView.layer.masksToBounds = YES;
    self.imageView.layer.cornerRadius = 65;
    self.imageView.layer.masksToBounds = YES;
}


- (IBAction)settingBtnClick:(UIButton *)sender {
    
    if (self.setBtnClick) {
        
        self.setBtnClick();
    }
}

- (IBAction)addBtnClick:(UIButton *)sender {
    
    if (self.addBtnClick) {
        
        self.addBtnClick();
    }
}


- (void)setModel:(ZZLightViewCellModel *)model{
    
    
    _model = model;
    NSString *path_document = NSHomeDirectory();
    //设置一个图片的存储路径
    NSString *imagePath = [path_document stringByAppendingString:[NSString stringWithFormat:@"/Documents/%@",model.imagePath]];
    self.imageView.image = [UIImage imageWithContentsOfFile:imagePath];
    self.titleLabel.text = model.title;
    self.addBtn.hidden = YES;
    self.setBtn.hidden = NO;
    self.directionImage.hidden = NO;
//    for (UIView *view in self.lightViewContentView.subviews) {
//
//        [view removeFromSuperview];
//    }
    NSMutableArray *colors = [NSMutableArray array];


    if (model.model == LightModelAdd) {
        
        self.addBtn.hidden = NO;
        self.setBtn.hidden = YES;
        self.directionImage.hidden = YES;
    }
    
    if (model.isAnticlockwise) {
        
        self.directionImage.image = [UIImage imageNamed:@"img_nsz"];
    } else {
        
        self.directionImage.image = [UIImage imageNamed:@"img_ssz"];
    }
    

    
}




@end
